-- Copyright (c) 2025 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

-- Description: PMBUS独立vrd升级

local pmbus_vrd_upgrade = {}
pmbus_vrd_upgrade.__index = pmbus_vrd_upgrade

-- vrd_manager_collection: key为position, value为ind_vrd_manager对象
function pmbus_vrd_upgrade.new(bus, db, vrd_manager_collection)
    return setmetatable({
        bus = bus,
        db = db,
        is_activing = false,
        is_upgrading = false,
        vrd_manager_collection = vrd_manager_collection, -- VRD管理器集合
        cfg_path = '',
        hpm_path = '',
        before_upgrade_version = '',
        upgrade_vrd_manager = nil, -- 待升级的VRD管理器对象
        prog_stats_i = nil,        -- 进度统计对象
        power_state = '',          -- 电源状态
        poweron_locked = false,    -- 上电锁状态
        vrd_cached = false,        -- VRD缓存状态
        system_id = nil            -- 当前升级的system_id
    }, pmbus_vrd_upgrade)
end

return pmbus_vrd_upgrade
